Operational Reasoning for Functions with Local State
نویسندگان
چکیده
Languages such as ML or Lisp permit the use of recursively defined function expressions with locally declared storage locations. Although this can be very convenient from a programming point of view it severely complicates the properties of program equivalence even for relatively simple fragments of such languages—such as the simply typed fragment of Standard ML with integer-valued references considered here. This paper presents a method for reasoning about contextual equivalence of programs involving this combination of functional and procedural features. The method is based upon the use of a certain kind of logical relation parameterised by relations between program states. The form of this logical relation is novel, in as much as it involves relations not only between program expressions, but also between program continuations (also known as evaluation contexts). The authors found this approach necessary in order to establish the ‘Fundamental Property of logical relations’ in the presence of both dynamically allocated local state and recursion. The logical relation characterises contextual equivalence and yields a proof of the best known context lemma for this kind of language— the Mason-Talcott ‘ciu’ theorem. Moreover, it is shown that the method can prove examples where such a context lemma is not much help and which involve representation independence, higher order memoising functions, and profiling functions.
منابع مشابه
Operational Semantics and Program Equivalence
This tutorial paper discusses a particular style of operational semantics that enables one to give a ‘syntax-directed’ inductive definition of termination which is very useful for reasoning about operational equivalence of programs. We restrict attention to contextual equivalence of expressions in the ML family of programming languages, concentrating on functions involving local state. A brief ...
متن کاملObservable Properties of Higher Order Functions that Dynamically Create Local Names, or What's new?
The research reported in this paper is concerned with the problem of reasoning about properties of higher order functions involving state. It is motivated by the desire to identify what, if any, are the difficulties created purely by locality of state, independent of other properties such as side-effects, exceptional termination and non-termination due to recursion. We consider a simple languag...
متن کاملObservable Properties of Higher Order Functionsthat
The research reported in this paper is concerned with the problem of reasoning about properties of higher order functions involving state. It is motivated by the desire to identify what, if any, are the diiculties created purely by locality of state, independent of other properties such as side-eeects, exceptional termination and non-termination due to recursion. We consider a simple language (...
متن کاملObservable Properties of Higher Order
The research reported in this paper is concerned with the problem of reasoning about properties of higher order functions involving state. It is motivated by the desire to identify what, if any, are the diiculties created purely by locality of state, independent of other properties such as side-eeects, exceptional termination and non-termination due to recursion. We consider a simple language (...
متن کاملOperational Versus Denotational Methods in the Semantics of Higher Order Languages
In the last few years increasing use has been made of structural operational semantics to study aspects of programming languages which traditionally have been analysed via denotational semantics. (The articles in the recent collection by Gordon and Pitts 1998 are a good illustration of this development and its applications.) Since there are more or less adequate denotational models for programm...
متن کاملLocal State in Hoare Logic for Imperative Higher-Order Functions
We introduce an extension of Hoare logic for imperative higher-order functions with local state. Local state may be generated dynamically and exported outside its scope, may store higher-order functions, and may be used to construct complex shared mutable data structures. The induced behaviour is captured with a first order predicate which asserts reachability of reference names. The logic enjo...
متن کامل